package com.airlines.crewassignment.job;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.airlines.crewassignment.service.ruleverification.RuleVerificationService;

/**
 * @author xxxx
 * @date 2018/5/7
 * @company xxxx Airlines
 * @description 每天计算一次任务用于获取排班的规则计算
 */
@Component 
public class RuleVerificationJob {
	Log  log = LogFactory.getLog(RuleVerificationJob.class);
	
	@Autowired
	private RuleVerificationService ruleVerificationService;


    /**
     * 每天一点钟进行判断当天排班是否符合所有排班需求
     */
//    @Scheduled(cron = "0 19 17 * * ? ")
    public void job(){
        log.info("the rule verification job is begin... ");
        DateTime flightDateStart = new DateTime().withTimeAtStartOfDay();
        DateTime flightDateEnd  = flightDateStart.plusDays(7);
        ruleVerificationService.checkAndSaveAssignmentF(flightDateStart, flightDateEnd);
        log.info("the rule verification is end. total time : ");
    }
}
